<?php
class T_SimpleEncrypt
{
	//该 $txt 中不能有_字段
	public static function passport_encrypt($txt, $key="1988") 
	{
		$txt = empty($txt) ? 0: $txt;
		$key = empty($key) ? 0: $key;
		return str_replace('%', '-', urlencode(base64_encode($txt.'_'.$key)));
		
	}
	public static function passport_decrypt($txt, $key="1988") 
	{
		$txt = empty($txt) ? 0: $txt;
		$key = empty($key) ? 0: $key;
	    $decrypt = base64_decode(urldecode(str_replace('-', '%', $txt)));
		$str = explode('_', $decrypt);
		return $str[0];
	}
	
}
?>